window.onload = function () {
  var calendarym = new LCalendar()
      calendarym.init({
        trigger: "#demo4",
        type: "ym",
        minDate: "2010-1",
        maxDate: "2099-12", //最大日期 注意：该值会覆盖标签内定义的日期范围
      })
  
  const constent=document.querySelector('.header a img')
  constent.addEventListener('touchstart', function () {
    location.href='我的主页.html'
  })


  // 顶部从主页取的数据
  
  const assignments = document.querySelector('.assignments')
  const num= JSON.parse(localStorage.getItem('assignments'))
  assignments.innerHTML = `
  <div id="total">
    <p>${num.assemble}</p>
    <div class="a">任务总量</div>
  </div>
  <div id="complete">
    <p>${num.completed}</p>
    <div class="a">完成任务量</div>
  </div>
  <div id="mileage">
    <p>${num.mileage}</p>
    <div class="a">运输里程(km)</div>
  </div>
  `

  // 日期左右按钮
  const zuo = document.querySelector('.img1')
  const you = document.querySelector('.img2')
  const demo = document.querySelector('#demo4')
  let num1 = demo.placeholder.substring(0, 4)
  let num2  = demo.placeholder.substring(6,7)
  demo.placeholder = `${num1}-${num2}`
  console.log(demo.value)
  console.log(demo)
  zuo.addEventListener('touchstart', function () {
    num2++
    if (num2 > 12) {
      num2 = 1
      num1++
    }
    demo.placeholder = `${num1}-${num2}`
  })
  you.addEventListener('touchstart', function () {
    num2--
    if (num2 < 1) {
      num2 = 12
      num1--
    }
    demo.placeholder = `${num1}-${num2}`
  })
 
  
 
}